﻿using System.Linq.PageList;
using Dyao.Book.Contract;

namespace Dyao.Book.Application.Abstractions
{
    public interface IBookMgrApplication
    {
        /// <summary>
        /// 分页获取书籍信息
        /// </summary>
        /// <param name="pageFilter">分页筛选器</param>
        /// <param name="cancellationToken">取消操作的通知</param>
        /// <returns>书籍信息</returns>
        Task<IPageList<BookResultDto>> GetPageListAsync(IPageFilter<BookFilterDto> pageFilter, CancellationToken cancellationToken = default);

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="book">书籍信息</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<string> AddAsync(BookInfoDto book, CancellationToken cancellationToken = default);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="book">书籍信息</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<string> ModifyAsync(BookInfoDto book, CancellationToken cancellationToken = default);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="bookId">书籍Id</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<string> DeleteAsync(string bookId, CancellationToken cancellationToken = default);

        /// <summary>
        /// 同步书源
        /// </summary>
        /// <param name="taskCenter">任务中心</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task SyncBookSourceAsync(TaskCenterDto taskCenter, CancellationToken cancellationToken = default);
    }
}
